﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace ShenMaPrint
{
    public partial class Form2 : Form
    {
        [DllImport("user32.dll")]
        public static extern int MessageBoxTimeoutA(IntPtr hWnd, string msg, string Caps, int type, int Id, int time);//引用DLL
        Form1 f;
        public Form2(Form1 f1)
        {
          
            InitializeComponent();
            f = f1;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string Name = INIFileHelper.ReadIniValue("Setting", "Name", Application.StartupPath + @"\Setting.ini").Trim();
            string PassWoard = INIFileHelper.ReadIniValue("Setting", "Password", Application.StartupPath + @"\Setting.ini").Trim();
            if (textBox1.Text == Name && textBox2.Text == PassWoard)
            {
                f.IsLand = true;

                this.Close();
                Form1.f2 = null;
                MessageBoxTimeoutA((IntPtr)0, "登录成功", "提示", 0, 0, 3000);
                f.GetInfo();
            }
            else
            {
                
                MessageBoxTimeoutA((IntPtr)0, "登录名或密码错误", "提示", 0, 0, 3000);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Form1.f2 = null;
            this.Close();
        }
    }
}
